﻿namespace Snake.App.Entities
{
	public class Field
	{
		public Field()
		{
			UpperLimit = 30;
			LowerLimit = 0;
			RightLimit = 50;
			LeftLimit = 0;
		}

		public int UpperLimit { get; set; }
		public int LowerLimit { get; set; }
		public int RightLimit { get; set; }
		public int LeftLimit { get; set; }

		/// <summary>
		/// Входит ли точка в игровое поле
		/// </summary>
		/// <param name="point"></param>
		/// <returns></returns>
		public bool CheckNotChrash(Coordinate point)
		{
			return point.X >= LeftLimit &&
			       point.X <= RightLimit &&
			       point.Y >= LowerLimit &&
			       point.Y <= UpperLimit;
		}

		public Coordinate GetCenter()
		{
			return new Coordinate((RightLimit - LeftLimit)/2, (UpperLimit - LowerLimit)/2);
		}
	}
}